package testDemo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 黎鹤舞
 * Date: 2023-11-18
 * Time: 17:44
 */
public class Test {

    //向上转型
    public static void fun(Animal animal) {
        animal.eat();
    }

    //接口的妙用
    public static void flayAction(IFly iFly) {
        iFly.fly();
    }

    public static void main(String[] args) {
        Dog dog = new Dog("旺财");
        Bird bird = new Bird("麻雀");
        Duck duck = new Duck("老北京烤鸭");

        fun(duck);

        flayAction(bird);
        flayAction(new Duck("鸭王"));
    }
}
